{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 读取byte文件（.ubyte）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(2051,)\n",
      "(60000,)\n",
      "(28,)\n",
      "(28,)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "\n",
    "#使用read（size）来读取\n",
    "#train_set的数据：0004 magicnumb 0008：number of items 0009- :label\n",
    "import struct\n",
    "with open('./MNIST_data/train-images-idx3-ubyte','rb') as f:\n",
    "#    32 bit integer\n",
    "    buffer = f.read(4)#读取4个字节32bit 1（integer）\n",
    "    head = struct.unpack('>i',buffer)\n",
    "    print(head)\n",
    "    buffer = f.read(4)\n",
    "    second = struct.unpack('>i',buffer)\n",
    "    print(second)\n",
    "    buffer = f.read(4)\n",
    "    three = struct.unpack('>i',buffer)\n",
    "    print(three)\n",
    "    buffer = f.read(4)\n",
    "    four = struct.unpack('>i',buffer)\n",
    "    print(four)\n",
    "#     读取60000, 28, 28的数据\n",
    "    length = second[0]*three[0]*four[0]\n",
    "    buffer = f.read(length)\n",
    "    data = struct.unpack('>%sB'%length,buffer)\n",
    "    print()\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(2051, 60000, 28, 28)\n"
     ]
    }
   ],
   "source": [
    "with open('./MNIST_data/train-images-idx3-ubyte','rb') as f:\n",
    "#    32 bit integer\n",
    "    buffer = f.read(4*4)#读取4个字节32bit 1（integer）\n",
    "    head = struct.unpack('>4i',buffer)\n",
    "    print(head)\n",
    "#     读取60000, 28, 28的数据(2051, 60000, 28, 28)\n",
    "    length = head[1]*head[2]*head[3]\n",
    "    buffer = f.read(length)\n",
    "    data = struct.unpack('>%sB'%length,buffer)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        ...,\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0]],\n",
       "\n",
       "       [[0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        ...,\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0]],\n",
       "\n",
       "       [[0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        ...,\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0]],\n",
       "\n",
       "       ...,\n",
       "\n",
       "       [[0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        ...,\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0]],\n",
       "\n",
       "       [[0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        ...,\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0]],\n",
       "\n",
       "       [[0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        ...,\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0]]])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "#将数据转换成60000*28*28的三维矩阵\n",
    "imgs = np.reshape(data,(head[1],head[2],head[3]))\n",
    "imgs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#读取图片\n",
    "import matplotlib.pyplot as plt\n",
    "for i in range(1010,1015):\n",
    "    plt.imshow(imgs[i])\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 读取.mat文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'DESCR': 'mldata.org dataset: mnist-original',\n",
       " 'COL_NAMES': ['label', 'data'],\n",
       " 'target': array([0., 0., 0., ..., 9., 9., 9.]),\n",
       " 'data': array([[0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        ...,\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0],\n",
       "        [0, 0, 0, ..., 0, 0, 0]], dtype=uint8)}"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# mnist-original.mat\n",
    "from sklearn.datasets import fetch_mldata\n",
    "import warnings\n",
    "warnings.filterwarnings(\"ignore\")\n",
    "#方法内部处理：将大写换成小写，空格换成横杠\n",
    "#在当前文件夹 搜索mldata 内的MNIST original  \n",
    "minst = fetch_mldata('MNIST original',data_home = './')\n",
    "minst"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "y = minst['target']#(70000,)\n",
    "x = minst['data']#(70000, 784)\n",
    "x_train,x_test,y_train,y_test = x[:60000],x[60000:],y[:60000],y[60000:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAOIElEQVR4nO3dbYxc5XnG8evCXpbWQGRDIMaY19okQBVDtqbEbURFQoEPvFRNBaoiaFFN1KBAi6pS8gGkVioKhTRtKZETHNw0BaUBxxalLa6LiiAtYg0OGNwCoa5tvLFjmQBuEntt3/2wA13MnGfWM2de7Pv/k1Yzc+45c26N9toze55z5nFECMCh77B+NwCgNwg7kARhB5Ig7EAShB1IYnovN3a4h+MIzejlJoFUfqr/1e7Y5Wa1jsJu+2JJX5Y0TdLXIuKO0vOP0Ayd5ws72SSAgqdjdWWt7Y/xtqdJukfSJZLOlHS17TPbfT0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DMo131TTj6vN71/fpzyOi5z+SLtXEEfnvS/pCP3qo6Os0Sd9r/LzY794kPaCJj3XjmvhEdJ2kYyStlvRK43bWAPX2DUkvSHpeE8Ga3afefkkT/xo+L2lt4+fSfr93hb568r5xuiyQBGfQAUkQdiAJwg4kQdiBJAg7kARhB5Ig7EAS/wfYIixtW94MdwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "t_59999 = x_train.reshape(60000,28,-1)[59999]\n",
    "plt.imshow(t_59999)\n",
    "some_digit = x[36000]\n",
    "plt.imshow(some_digit.reshape(28,-1))\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x1e1c52b0>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAMvklEQVR4nO3dbYxc5XnG8evCWWzJ4GCHmli2G5zUieImraErNyltSkWKDFJroihNLCVyI5JNK2ihQlER+RAqRRWq8gKKKqRNsDBp4ihqguwgJ8GykCzUBFgcB0xNwksNON74Ja4KRqnZte9+2ONqMTvPjmfOzBn7/v+k0cyce86eW0e+fM6cZ2YeR4QAnPvOa7oBAP1B2IEkCDuQBGEHkiDsQBJv6ufGzvfcmKf5/dwkkMr/6lW9Fsc9U62rsNteK+kuSXMkfT0i7ii9fp7m6w99VTebBFDwSOxoWev4NN72HEn/KukaSaskrbe9qtO/B6C3unnPv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vWlt0bfswPon6aP7AD6hLADSTQSdttrbf/c9rO2b22ih1Zs77P9pO3dtsca7mWj7UO290xbtsj2dtvPVPczzrHXUG+32/5lte922762od6W237I9l7bT9m+qVre6L4r9NWX/db39+y250j6haQ/l7Rf0mOS1kfEf/a1kRZs75M0HBGNfwDD9gckHZN0X0S8p1r2L5KORsQd1X+UCyPiHwekt9slHWt6Gu9qtqIl06cZl3SdpL9Wg/uu0NdfqQ/7rYkj+xpJz0bE8xHxmqRvS1rXQB8DLyJ2Sjp62uJ1kjZVjzdp6h9L37XobSBExHhE7KoevyLp1DTjje67Ql990UTYl0p6adrz/Rqs+d5D0oO2H7c90nQzM7gkIsalqX88khY33M/pZp3Gu59Om2Z8YPZdJ9Ofd6uJsM80ldQgjf9dERGXS7pG0g3V6Sra09Y03v0ywzTjA6HT6c+71UTY90taPu35MkkHGuhjRhFxoLo/JOl+Dd5U1AdPzaBb3R9quJ//N0jTeM80zbgGYN81Of15E2F/TNJK2ytsny/pY5K2NtDHG9ieX104ke35kq7W4E1FvVXShurxBklbGuzldQZlGu9W04yr4X3X+PTnEdH3m6RrNXVF/jlJn2uihxZ9vV3Sz6rbU033Jmmzpk7rJjR1RnS9pLdI2iHpmep+0QD19g1JT0p6QlPBWtJQb3+sqbeGT0jaXd2ubXrfFfrqy37j47JAEnyCDkiCsANJEHYgCcIOJEHYgSQIO5AEYQeS+D94WckZxPkt3AAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#将0-60000之间的数字重新洗牌\n",
    "# np.random.seed = 0 #随机seed设置问题\n",
    "shuffle_index = np.random.permutation(60000)\n",
    "x_train,y_train = x_train[shuffle_index],y_train[shuffle_index]\n",
    "z_50000 = x_train.reshape(60000,28,-1)[50000]\n",
    "plt.imshow(z_50000)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 训练一个二元分类器 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([False, False, False, ..., False, False, False])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#识别数值为5或者非5\n",
    "y_train_5 = (y_train==5)\n",
    "y_train_5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "SGDClassifier(alpha=0.0001, average=False, class_weight=None,\n",
       "              early_stopping=False, epsilon=0.1, eta0=0.0, fit_intercept=True,\n",
       "              l1_ratio=0.15, learning_rate='optimal', loss='hinge',\n",
       "              max_iter=1000, n_iter_no_change=5, n_jobs=None, penalty='l2',\n",
       "              power_t=0.5, random_state=42, shuffle=True, tol=0.001,\n",
       "              validation_fraction=0.1, verbose=0, warm_start=False)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#SGD主要应用在大规模稀疏数据问题上，经常用在文本分类及自然语言处理\n",
    "from sklearn.linear_model import SGDClassifier\n",
    "sgd_clf = SGDClassifier(random_state = 42)\n",
    "sgd_clf.fit(x_train,y_train_5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([False, False, False, ..., False, False, False])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "prdct_5 = sgd_clf.predict(x_train)\n",
    "prdct_5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False    52947\n",
       "True      7053\n",
       "dtype: int64"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd \n",
    "pd.Series(prdct_5).value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.96066994, 0.97133333, 0.95425   , 0.96708333, 0.96141345])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#交叉验证\n",
    "from sklearn.model_selection import cross_val_score\n",
    "cvl = cross_val_score(sgd_clf,x_train,y_train_5,cv =5,scoring = 'accuracy')\n",
    "cvl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "#自定义非5模型\n",
    "from sklearn.base import BaseEstimator\n",
    "class Never5(BaseEstimator):\n",
    "    def __init__(self):\n",
    "        pass\n",
    "    \n",
    "    def fit(self,x,y=None):\n",
    "        pass\n",
    "    \n",
    "    def predict(self,x):\n",
    "        return np.zeros((len(x),1),dtype = bool)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.90958333, 0.90916667, 0.90808333, 0.91516667, 0.90625   ])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "never_5 = Never5()\n",
    "cross_val_score(never_5,x_train,y_train_5,cv =5,scoring = 'accuracy')\n",
    "#此处没有实现fit，transform的方法（没有对该模型进行训练）\n",
    "#这样预测的数据与目标数据没有关系，这样得到的结果只是因为标签在总体数据中的比列，无关预测"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "SGDClassifier(alpha=0.0001, average=False, class_weight=None,\n",
       "              early_stopping=False, epsilon=0.1, eta0=0.0, fit_intercept=True,\n",
       "              l1_ratio=0.15, learning_rate='optimal', loss='hinge',\n",
       "              max_iter=1000, n_iter_no_change=5, n_jobs=None, penalty='l2',\n",
       "              power_t=0.5, random_state=42, shuffle=True, tol=0.001,\n",
       "              validation_fraction=0.1, verbose=0, warm_start=False)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_train_un5 = (y_train!=5)\n",
    "sgd_clf.fit(x_train,y_train_un5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True     61743\n",
       "False     8257\n",
       "dtype: int64"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "prdct_un5 = sgd_clf.predict(x)\n",
    "pd.Series(prdct_un5).value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import cross_val_predict\n",
    "cvp = cross_val_predict(sgd_clf,x_train,y_train_5,cv=3)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[53733,   846],\n",
       "       [ 1371,  4050]], dtype=int64)"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.metrics import confusion_matrix\n",
    "confusion_matrix(y_train_5,cvp)\n",
    "#第一行第一个00：正确的归类‘非5’的数量 \n",
    "#第一行第二个01：错误的归类于‘是5’的数量\n",
    "#第二行第一个10：错误的归类于‘非5’的数量\n",
    "#第二行第二个11：正确的归类于‘是5’的数量\n",
    "#每一列都是每个分类的预测值，每一行都是每个分类的真实值"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " ![jupyter](./matrix.png)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "precision_score:  0.6818375159506593\n",
      "recall_score:  0.8871057000553404\n",
      "f1_score:  0.7710437710437711\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import precision_score,recall_score,f1_score\n",
    "#精确率和召回率,f1谐波平均值\n",
    "#精确率：某分类的预测数正确数/该分类的总预测数:TP/(TP+FP)\n",
    "#召回率:某分类的目标值/某分类的所有数量：TP/(TP+FN)\n",
    "print('precision_score: ',precision_score(y_train_5,prdct_5))\n",
    "print('recall_score: ',recall_score(y_train_5,prdct_5))\n",
    "print('f1_score: ',f1_score(y_train_5,prdct_5))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 精度/召回率权衡调整 \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-2040.28712322])"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#得到一个决策值，通过设置大于或者小于决策值得数据为False|True来达到调整阈值的目的\n",
    "y_scores = sgd_clf.decision_function([some_digit])\n",
    "y_scores"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ True])"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "thread_hold = -3700\n",
    "y_scores>thread_hold"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([False])"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "thread_hold = 0\n",
    "y_train_some_digit = (y_scores>thread_hold)\n",
    "y_train_some_digit"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-11574.76940413, -14778.25624719, -31117.64637204, ...,\n",
       "       -10067.9838299 ,  -4035.15411877, -15329.59281531])"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_scores = cross_val_predict(sgd_clf,x_train,y_train_5,cv =5,method = 'decision_function')\n",
    "y_scores"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "precision:  [0.09077665 0.09076142 0.09076294 ... 1.         1.         1.        ]\n",
      "recall:  [1.00000000e+00 9.99815532e-01 9.99815532e-01 ... 3.68935621e-04\n",
      " 1.84467810e-04 0.00000000e+00]\n",
      "theadhold:  [-47393.42540516 -47358.52208365 -47301.99027357 ...  19819.66047232\n",
      "  20184.04794606  23908.59234109]\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import precision_recall_curve\n",
    "precision,recall,thead_hold = precision_recall_curve(y_train_5,y_scores)\n",
    "print('precision: ',precision)\n",
    "print('recall: ',recall)\n",
    "print('theadhold: ',thead_hold)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'numpy.ndarray'>\n",
      "<class 'numpy.ndarray'>\n",
      "<class 'numpy.ndarray'>\n"
     ]
    }
   ],
   "source": [
    "print(type(thead_hold))\n",
    "print(type(precision))\n",
    "print(type(recall))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAAEPCAYAAACgFqixAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3dd3hUZdr48e+dSoBASKEGIfQSkBIQsYBIE1Ys666w8KrrT9FVfHdd1hXLCovrWldxZS286rIqiliwIE1RcVWQonSIhF5TIISe+vz+ODPJJEySCZmZMzO5P9d1rtOec859wjD3nPI8jxhjUEopVbeF2R2AUkop+2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WPA0uxesTahdVz3pkaHu8gVg9em4GXgPexniOMNsYsrmbz67ES0uPAu1g/2ibV5PhK1ZT2dKaUUkqvDJRSSmkyUEophSYDpZRSaDJQSimFJgOllFJoMlBKKYUmA6WUUmgyUEopBfx/M2Y9agZ75EMAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(thead_hold,precision[:-1],'b--',label = 'Precision',linewidth = 2)\n",
    "plt.plot(thead_hold, recall[:-1], \"g-\", label=\"Recall\", linewidth=2)\n",
    "plt.ylim([0,1])\n",
    "plt.xlim([-70000,40000])\n",
    "plt.xlabel(\"Threshold\", fontsize=16)\n",
    "plt.legend(loc=\"upper left\", fontsize=16)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "precision: 0.9510175922731977\n",
      "recall: 0.5085777531820698\n"
     ]
    }
   ],
   "source": [
    "#将阈值移到2000，保证精确率在90%以上\n",
    "y_train_predict_90 = (y_scores>2000)\n",
    "print('precision:',precision_score(y_train_5,y_train_predict_90))\n",
    "print('recall:',recall_score(y_train_5,y_train_predict_90))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### ROC 曲线 :ROC曲线上的每个点的横坐标就是FPR，纵坐标就是TPR。\n",
    "#### 真正例率（true positive rate，另一个名字叫做召回率）：TPR\n",
    "#### 假正例率（false positive rate, FPR）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " ![jupyter](./matrix.png)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.metrics import roc_curve\n",
    "fpr, tpr, thresholds = roc_curve(y_train_5, y_scores)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib\n",
    "#解决plt.xlabel中文显示乱码的问题\n",
    "zhfont1 = matplotlib.font_manager.FontProperties(fname='C:\\Windows\\Fonts\\simkai.ttf')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAEKCAYAAADn+anLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3dd3wUdf748dd7d1MgJJRQREInCQSQagAriopBBAsWRLEEsZ79i3KWQ+WwyyGKUhRUzoLtJ/bzbId3NlREEnooodckhNTNfn5/zCZGTEiI2czO7vv5ePDIltmZd4bNvOfz+cznPWKMQSmllKqKy+4AlFJKBS9NEkoppaqlSUIppVS1NEkopZSqliYJpZRS1dIkoZRSqloBSxIi8oKI7BKRFdW8LyLylIisE5HlItI/ULEopZSqm0C2JBYAZx7m/TQg0f9vIvBsAGNRSilVBwFLEsaY/wD7DrPIaOAlY/kWaCYibQMVj1JKqSNn55hEOyC70vMt/teUUkoFCY+N25YqXquyRoiITMTqkiImJmZA9+7dAxmXUqqeGQM+TMVfeMUfesVLBp+xlgODqbRQ+fsGKPMZpPy1Q9ZlDPiMweszuF1C5ZJDxr8dY8q3Y3732Uqh/bY1AweKvbgQXC5rHSVlPlxirdsRBY28xZTsyQbYY4xpVZdV2JkktgDtKz1PALZVtaAxZg4wB2DgwIFm6dKlgY9OqSBjjKHMZx0E84pKKfH6OFhcRkGJF5//AFnm++3fjrwiojwu1u8+SEykG6/P4C2zXi/2ltE40o23zFrfT5v2Ex3hZt/BEprHRFoHQf86DdZP/M99xjqI+nxWXFtzComN9lS8X1bpQFzmsx43JBd/PNsUfjsrdR/BuhrV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kpVSy+BVUopVS1NEkoppaqlSUIppVS1NEkopZSqliYJpZRS1fr/Yi7+VzJ6WZoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#FPR 是反例被错误分成正例的在所有反例中比率 :\n",
    "#它等于 1 减去真反例率（true negative rate， TNR）。\n",
    "#FP:实际为负，但预测为正\n",
    "#TN：实际为负，预测为负\n",
    "# TNR是反例被正确分类的比率。TNR也叫做特异性 TNR = TN/(FP+TN)\n",
    "#FPR = 1-TN/(TN+FP) = FP/(FP+TN)\n",
    "#TPR = TP/(TP+FN):\n",
    "def plot_roc_cve(fpr, tpr, label=None):\n",
    "    plt.plot(fpr, tpr, linewidth=2,label=label)\n",
    "    plt.plot([0, 1], [0, 1], 'k--')\n",
    "    plt.axis([0, 1, 0, 1])\n",
    "    plt.xlabel('假正类率', fontsize=16,fontproperties=zhfont1)\n",
    "    plt.ylabel('真正类率', fontsize=16,fontproperties=zhfont1)\n",
    "plot_roc_cve(fpr,tpr)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9591791280791755"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 计算曲线下面积AUC，虚线是随机分类0.5到1\n",
    "from sklearn.metrics import roc_auc_score\n",
    "roc_auc_score(y_train_5, y_scores)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 训练随机森林分类器，比较SGD分类器的ROC曲线和AUC分数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1., 0.],\n",
       "       [1., 0.],\n",
       "       [1., 0.],\n",
       "       ...,\n",
       "       [1., 0.],\n",
       "       [1., 0.],\n",
       "       [1., 0.]])"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.ensemble import RandomForestClassifier\n",
    "forest_clf = RandomForestClassifier(n_estimators = 10,random_state = 42)\n",
    "#交叉验证,\n",
    "y_proboss_forest = cross_val_predict(forest_clf,x_train,y_train_5,cv  = 3,\n",
    "                                    method = 'predict_proba')\n",
    "#predict_proba:返回一个矩阵，每行一个实例，每列代表一个概率\n",
    "y_proboss_forest"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(60000, 2)"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_proboss_forest.shape\n",
    "#第一列代表非5的概率，第二列代表是5的概率"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "#绘制ROC曲线，需要分数而不是概率\n",
    "#sklearn.metrics.roc_curve(y_true, y_score, pos_label=None, sample_weight=None, drop_intermediate=True)\n",
    "# y_true : 数组，shape = [样本数]           \n",
    "# 在范围{0,1}或{-1,1}中真正的二进制标签。如果标签不是二进制的，则应该显式地给出pos_label\n",
    "# y_score : 数组, shape = [样本数]            \n",
    "# 目标得分，可以是积极类的概率估计，信心值，或者是决定的非阈值度量(在某些分类器上由“decision_function”返回)。\n",
    "# https://blog.csdn.net/u014264373/article/details/80487766\n",
    "y_scores_forest = y_proboss_forest[:,1]\n",
    "fpr_forest,tpr_forest,thread_forest = roc_curve(y_train_5,y_scores_forest)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAEKCAYAAADn+anLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJ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04VQN577z35448/5I8//pDQ0NBU/6aunE8i+10bZZFly5bRt29fjh07xsCBA+OH91Y5g/+QZXaHAMCBtx7I8HtfeOEFXnzxxfjfmzdvHv9cRLjjjjuIiIhgwoQJvPnmm0lu27548SKbN2+OH8K+RIkSNGjQgOXLl/P4448TExPDiBEjaN26NXPnzo1/n5+fH507d04Sx6hRo/Dx8WHVqlUUKlQIsM6g/f39GTlyJF9//XX8spcuXWL69OnceeedgDU/d+3atVm6dCkhISHkypULgG3btjFlyhSio6PjywA+/fRTPv300yTbX7lyJa1ateLcuXNMnDiRbt268f777wNWG4afnx9PPfUUS5cuTVJDICL8+OOP5MmTJ77sjTfe4ODBg2zdupWAgADAumnlwoULjBw5kmeffRZPT0/++OMP3nzzTZ544on49z766KPxz4OCggBrhkBXVI/dDMdVN9k9n8SZM2d48sknadu2LYUKFeKPP/5g3LhxmiCU4ySfxOr48eP06dOH8uXL4+3tjZeXF8OGDePChQucOnUqybJNmjRJMsdJzZo1ATh06BAAR44c4ciRIzz22GNJ3texY8fr6u1//fXX+P+nOAUKFKBdu3asWbMmybK+vr7xCQKgatWqgHUgTpwMqlatSlRUFMePH0/y/jZt2vD3338neTRq1AiAP//8k/DwcJ588skk7+ncuTOenp7XxXLfffclSRBgjebcqFEjKlSoQFRUVPyjdevWnD17lpCQEAAaNGjA+PHjmTx5Mlu3bnXrUZ8ddyVh9748deoU3377LSNGjGDo0KF4ezuwd5+6ZbdyBu8uSpYsGf88JiaGdu3acezYMUaMGEHVqlXJkycP33zzDWPGjOHatWtJ3lu4cOEkv8c1esctF3dwLl68eJLlPD09rxuG5ty5c0liiVOiRAnOnz+fpCxxIgHi//+ST8oVV55S3MHBKU/Qdu7cOYDrYomLOe71OCnFfOrUKfbs2YOXV8rDVZ89exaAzz//nJEjR/L222/z0ksvUbJkSfr27cuwYcPcrqOt45JE/nxZv82jR4+yaNEi+vfvT1BQEIcOHdKZ4pTjJb763bt3Lxs2bOCTTz5Jcib93XffZWjdcQfQkydPJimPioqKP1DGKVy4MCdOnLhuHSdOnLguGblS3LZOnDhB9erV48vjYk6e3FKqPShSpAjFihVj8uTJKW4jMDAQgGLFijF16lSmTp3Kf//9x7x58xg+fDh+fn48++yzmfWRMoV7pax0yMpaHRFh1qxZBAUF8eqrr8YPyKcJQmU3V65cAUhyBhwZGcmCBQsytL4yZcpQtmxZFi1alKT8q6++IioqKknZXXfdxbJly7h06VJ82aVLl/juu++46667MrT9jGjcuDE+Pj4sXLgwSfnnn39OVFRUumK577772LlzJ+XKlSM4OPi6R/78+a97T2BgIG+++Sa33XYb27ZtAxKuzK5evZoJn+zWOO5KIqvs3buXXr16sXr1apo3b86sWbN0QD6VbVWrVo3y5cvz6quvkitXLry8vJg0aVKG1+fh4cHw4cPp2bMnTz/9NJ07d2bPnj2MHTv2us5rr732GkuXLqVly5YMHjwYYwzjxo3jypUrvP7667f60dKtcOHCDBgwgLFjx+Lr68v999/Pjh07GDZsGM2aNeOBB9KuYuzfvz+ff/45d9xxB/379ycwMJDLly+zc+dO1q5dy7fffktoaCitWrXiiSeeoGrVqnh5efHtt99y/vx57r33XgCqVKmCp6cnH374IYULF8bHx4fAwMAUk4yrOS5JXL2W9jK3KjIykubNm3Px4kVmzpxJjx493K6eUKnM5O3tzTfffMPzzz9P165dKVy4MM888wzlypWjV69eGVpnjx49CAsLY+LEiXz22WfUqFGDhQsXXtcwXKtWLX755RdeffVVunXrhojQuHFj1qxZQ+3atTPj46XbmDFj8PPzY/r06UybNo0iRYrQtWtXxo4dm65jQMGCBVm3bh2jRo1i3LhxHD16lEKFChEYGEjHjh0ByJ07N/Xq1WPWrFkcPHgQDw8PAgMDWbBgAe3btwesaqv333+fcePGcddddxEdHR1/wprVjDu3qqfEt1h1uXxqu0vWvWvXLipXroyHhwerVq0iMDCQMmXKuGRbyhl27NhBtWrV7A5DqRtK63tqjNkoIim32KfBcafHeVwwn0RERAQjRoygRo0azJgxA4CWLVtqglBK5XiOq25K5c6yDFu/fn38UBpPPPFEkg4tS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lFIqVZoklFJKpUqThFIuENt/RynH0y+yyvGMMTWAEyJy5ibeUxC4GjteUEqaxN6TvwVrsLWwVNbTGqtz02UR+ewmQ1fK5TRJKAUPA0eMMRFYfU4uAI8BfUQkvtOVMeYOrE5ZFYCTwIfAzuQrM8a0weqbIEBrYD9wXZIwxjwC9ItdzxJjzJMiMj9zP5pSt0arm1SOZozJjTVC6BUgBMiL1Vv538QJAkBE1gJvYfUvGiQiKSWIAkBxoC9QDauzZ3SyZTyMMYOBGOAfoBFQGNiRuZ9OqVunSULldD2xep+eAe4G1mD14P8q8ULGmNrGmLoicg3wMMY8Y4y5N/nKROQi1vwG24DzQFWsnsCJ5YtdZhPWFcZxrHGVnsrEz6VUptAkoXIsY0xVYifmwTqrj8a6osgNvJNs8Uhix0LCqkb6BfgphXVWiH19H/Ad1sCLeZI1ZBfBGq65OdYAa+ewksobxhi/W/9kSmUebZNQOdkhEdlpjGmAdWD/D/AFLmINEJjYceBq7PNdInLdYHnGmMJYJ14Ga8j2l2NfKgocM8Y0xEpGEbHL5AFKAs8DXQEfINwY85yIbMq0T6nULdAkoXKsRDP6+WJVAeXFujrohJUoEsuNNdroo0CL2Nm8SmINnvaciBwCimENUb4PKxHMEJH3E6/EGJMLaAqEY12NnMIaiXNlpn9ApTKBDvCncjxjzHtYDcirgECsNorbgSeAkUAbrDaLXcBB4Hhs20Nq66uP1Rj9E1abx6siEpnKsvcAF0Xkr0z7QEplIk0SKsczxlTHml/gzK3MVhY7O96dQBER+Sq2rCvwItacH58m7y9hjLkTq9rrQEa3q5QraZJQysVik4cRkegUXsuL1SlP/xGVW9IkoZRSKlV6C6xSSqlUaZJQSimVKk0SSimlUqVJQimlVKo0SSillErV/wOyjZg1c+xsYgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(fpr, tpr, \"b:\", linewidth=2, label=\"SGD\")\n",
    "plot_roc_cve(fpr_forest,tpr_forest,label = \"randomForest\")\n",
    "plt.legend(loc=\"lower right\", fontsize=16)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 随机森林比SGD的效果要好"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9932327041300887"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#查看随机森林的AUC面积\n",
    "roc_auc_score(y_train_5,y_scores_forest)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9845950704225352"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#查看精度和召回\n",
    "y_train_predict_forest = cross_val_predict(forest_clf,x_train,y_train_5,cv = 3)\n",
    "precision_score(y_train_5,y_train_predict_forest)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 多分类\n",
    "#### 随机森林和朴素叶贝斯可以支持多分类\n",
    "#### 支持向量机SVM和线性分类器只可以处理二分类"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "#OVA:一对多，每个数字训练一个二分类器，10个数字训练10个二分类器，然后在对图片进行检测时，那个分数最高就属于那个\n",
    "#OVO：一对一，将10个数字两两分组。存在n个类别，需要n(n+1)个分类器，最后看那个类别分数最高\n",
    "#sklearn在检测到使用二分类器进行多分类的任务时，会自动运行OVA，SVM除外"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "SGDClassifier(alpha=0.0001, average=False, class_weight=None,\n",
       "              early_stopping=False, epsilon=0.1, eta0=0.0, fit_intercept=True,\n",
       "              l1_ratio=0.15, learning_rate='optimal', loss='hinge',\n",
       "              max_iter=1000, n_iter_no_change=5, n_jobs=None, penalty='l2',\n",
       "              power_t=0.5, random_state=42, shuffle=True, tol=0.001,\n",
       "              validation_fraction=0.1, verbose=0, warm_start=False)"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#使用SGD的分类器\n",
    "sgd_clf.fit(x_train,y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([5.])"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sgd_clf.predict([some_digit])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ -1529.40164186, -36130.95280774,  -7854.827258  ,\n",
       "         -3751.83209808, -26450.84013526,    421.84967718,\n",
       "        -18393.32296932, -13953.30377652, -13988.5113242 ,\n",
       "        -15844.29773076]])"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "some_digit_score = sgd_clf.decision_function([some_digit])\n",
    "some_digit_score\n",
    "#输出所有分类器的分数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.argmax(some_digit_score)\n",
    "#取出数组中的最大值的索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sgd_clf.classes_\n",
    "#目标类别按值大小进行排序存在classes_的属性中"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5.0"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sgd_clf.classes_[np.argmax(some_digit_score)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "OneVsOneClassifier(estimator=SGDClassifier(alpha=0.0001, average=False,\n",
       "                                           class_weight=None,\n",
       "                                           early_stopping=False, epsilon=0.1,\n",
       "                                           eta0=0.0, fit_intercept=True,\n",
       "                                           l1_ratio=0.15,\n",
       "                                           learning_rate='optimal',\n",
       "                                           loss='hinge', max_iter=5,\n",
       "                                           n_iter_no_change=5, n_jobs=None,\n",
       "                                           penalty='l2', power_t=0.5,\n",
       "                                           random_state=42, shuffle=True,\n",
       "                                           tol=-inf, validation_fraction=0.1,\n",
       "                                           verbose=0, warm_start=False),\n",
       "                   n_jobs=None)"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#使用OVO策略\n",
    "from sklearn.multiclass import OneVsOneClassifier\n",
    "ovo_clf = OneVsOneClassifier(SGDClassifier(max_iter=5, tol=-np.infty, random_state=42))\n",
    "ovo_clf.fit(x_train,y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([5.])"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ovo_clf.predict([some_digit])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "45"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(ovo_clf.estimators_)\n",
    "#查看有多少个分类器"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RandomForestClassifier(bootstrap=True, class_weight=None, criterion='gini',\n",
       "                       max_depth=None, max_features='auto', max_leaf_nodes=None,\n",
       "                       min_impurity_decrease=0.0, min_impurity_split=None,\n",
       "                       min_samples_leaf=1, min_samples_split=2,\n",
       "                       min_weight_fraction_leaf=0.0, n_estimators=10,\n",
       "                       n_jobs=None, oob_score=False, random_state=42, verbose=0,\n",
       "                       warm_start=False)"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#使用随机森林\n",
    "forest_clf.fit(x_train,y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0. , 0. , 0.1, 0. , 0. , 0.9, 0. , 0. , 0. , 0. ]])"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#随机森林直接将实例分为多个类别，调用predict_proba()可以获得分类器将每个实例分类为每个类别的概率列表\n",
    "forest_clf.predict_proba([some_digit])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.88047391, 0.8660933 , 0.87053058])"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#使用交叉验证测试SGD的准确率\n",
    "cross_val_score(sgd_clf,x_train,y_train,cv = 3,scoring = 'accuracy')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.93966207, 0.94184709, 0.94244137])"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cross_val_score(forest_clf,x_train,y_train,cv = 3,scoring = 'accuracy')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [],
   "source": [
    "#进行缩放\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "scaler = StandardScaler()\n",
    "x_train_scaler = scaler.fit_transform(x_train.astype(np.float64))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.8990202 , 0.90699535, 0.89888483])"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cross_val_score(sgd_clf,x_train_scaler,y_train,cv = 3,scoring = 'accuracy')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.93971206, 0.94174709, 0.94259139])"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cross_val_score(forest_clf,x_train_scaler,y_train,cv = 3,scoring = 'accuracy')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 选取一个合适的模型对其进行预测，然后将预测值和真实值放到混淆矩阵中比较，找到错误的地方，进行优化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[5604,    0,   15,    7,    9,   41,   36,    6,  204,    1],\n",
       "       [   0, 6425,   44,   20,    4,   44,    5,    9,  181,   10],\n",
       "       [  25,   26, 5263,   90,   64,   21,   67,   39,  353,   10],\n",
       "       [  28,   19,  114, 5245,    0,  203,   26,   43,  393,   60],\n",
       "       [   9,   14,   36,   11, 5244,    9,   40,   18,  306,  155],\n",
       "       [  30,   17,   28,  155,   53, 4498,   79,   18,  482,   61],\n",
       "       [  31,   16,   50,    4,   39,   90, 5549,    6,  133,    0],\n",
       "       [  22,   12,   55,   29,   55,   12,    6, 5704,  163,  207],\n",
       "       [  16,   61,   43,   92,    2,  119,   32,    7, 5431,   48],\n",
       "       [  25,   21,   32,   57,  127,   37,    1,  173,  341, 5135]],\n",
       "      dtype=int64)"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_train_predict = cross_val_predict(sgd_clf,x_train_scaler,y_train,cv=3)\n",
    "conf_mx = confusion_matrix(y_train,y_train_predict)\n",
    "conf_mx"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAECCAYAAADXWsr9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAALd0lEQVR4nO3dXYic5RnG8evaj8QkahI01JpIE0uxFWmJLK0aasEI/dDqiVDjR9GTtNBqFEG0hQo9FtEDEbaxqWBUypoDkWItWJGepF0TQeNaEbX5MOJakmhXTdzs3YMdabIfzrvd99l3xvv/AyE7Th5vhvn7zMy++6wjQgC+2HqaHgBAeYQOJEDoQAKEDiRA6EAChA4k0Fjotn9g+5+237B9V1NzVGX7HNt/tT1ie4/tLU3PVIXtXtu7bT/d9CxV2F5he8j2a63H+uKmZ2rH9u2t58Qrth+3fUrTM03VSOi2eyU9KOmHks6XtMn2+U3MMgfjku6IiG9IukjSL7pgZknaImmk6SHm4AFJz0TE1yV9Sx0+u+3Vkm6VNBARF0jqlXRts1NN19SO/m1Jb0TEmxFxTNITkq5uaJZKIuJgROxq/flDTT4BVzc71eezvUbSFZK2Nj1LFbZPl3SppIclKSKORcThZqeqpE/SEtt9kpZKeqfheaZpKvTVkvad8PV+dXg0J7K9VtJ6STubnaSt+yXdKWmi6UEqOlfSqKRtrbcbW20va3qozxMRByTdK2mvpIOSjkTEs81ONV1ToXuG27riWlzbp0p6UtJtEfFB0/PMxvaVkt6LiBebnmUO+iRdKOmhiFgvaU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hRE6kAChAwkQOpAAoQMJ/BcDt5iIT4leDgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 288x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.matshow(conf_mx,cmap ='plasma' )\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[5923],\n",
       "       [6742],\n",
       "       [5958],\n",
       "       [6131],\n",
       "       [5842],\n",
       "       [5421],\n",
       "       [5918],\n",
       "       [6265],\n",
       "       [5851],\n",
       "       [5949]], dtype=int64)"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#中间对角线的越亮表示预测的正确率越高\n",
    "#图片5的颜色相对较暗，1，图片5的数据量较小，2分类器在图片5的执行上效果不好\n",
    "#将矩阵中的每个值除以对应图片的数量，排除1的问题\n",
    "row_numb = conf_mx.sum(axis = 1,keepdims = True)\n",
    "row_numb"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[9.46142158e-01, 0.00000000e+00, 2.53250042e-03, 1.18183353e-03,\n",
       "        1.51950025e-03, 6.92216782e-03, 6.07800101e-03, 1.01300017e-03,\n",
       "        3.44420057e-02, 1.68833361e-04],\n",
       "       [0.00000000e+00, 9.52981311e-01, 6.52625334e-03, 2.96647879e-03,\n",
       "        5.93295758e-04, 6.52625334e-03, 7.41619697e-04, 1.33491546e-03,\n",
       "        2.68466330e-02, 1.48323939e-03],\n",
       "       [4.19603894e-03, 4.36388050e-03, 8.83350117e-01, 1.51057402e-02,\n",
       "        1.07418597e-02, 3.52467271e-03, 1.12453844e-02, 6.54582075e-03,\n",
       "        5.92480698e-02, 1.67841558e-03],\n",
       "       [4.56695482e-03, 3.09900506e-03, 1.85940303e-02, 8.55488501e-01,\n",
       "        0.00000000e+00, 3.31104224e-02, 4.24074376e-03, 7.01353776e-03,\n",
       "        6.41004730e-02, 9.78633176e-03],\n",
       "       [1.54056830e-03, 2.39643958e-03, 6.16227319e-03, 1.88291681e-03,\n",
       "        8.97637795e-01, 1.54056830e-03, 6.84697022e-03, 3.08113660e-03,\n",
       "        5.23793221e-02, 2.65320096e-02],\n",
       "       [5.53403431e-03, 3.13595278e-03, 5.16509869e-03, 2.85925106e-02,\n",
       "        9.77679395e-03, 8.29736211e-01, 1.45729570e-02, 3.32042059e-03,\n",
       "        8.89134846e-02, 1.12525364e-02],\n",
       "       [5.23825617e-03, 2.70361609e-03, 8.44880027e-03, 6.75904022e-04,\n",
       "        6.59006421e-03, 1.52078405e-02, 9.37647854e-01, 1.01385603e-03,\n",
       "        2.24738087e-02, 0.00000000e+00],\n",
       "       [3.51157223e-03, 1.91540303e-03, 8.77893057e-03, 4.62889066e-03,\n",
       "        8.77893057e-03, 1.91540303e-03, 9.57701516e-04, 9.10454908e-01,\n",
       "        2.60175579e-02, 3.30407023e-02],\n",
       "       [2.73457529e-03, 1.04255683e-02, 7.34917108e-03, 1.57238079e-02,\n",
       "        3.41821911e-04, 2.03384037e-02, 5.46915057e-03, 1.19637669e-03,\n",
       "        9.28217399e-01, 8.20372586e-03],\n",
       "       [4.20238696e-03, 3.53000504e-03, 5.37905530e-03, 9.58144226e-03,\n",
       "        2.13481257e-02, 6.21953269e-03, 1.68095478e-04, 2.90805177e-02,\n",
       "        5.73205581e-02, 8.63170281e-01]])"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "norm_conf_mx = conf_mx/row_numb\n",
    "norm_conf_mx"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAECCAYAAADXWsr9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgA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AAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 288x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#用0填充对角线，只保留错误\n",
    "#设置矩阵对角元素\n",
    "np.fill_diagonal(norm_conf_mx,0)\n",
    "plt.matshow(norm_conf_mx,cmap ='plasma' )\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [],
   "source": [
    "#每行为真实值，每列为预测值\n",
    "#第8列比较亮，说明图片被预测为8的情况比较多\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([640.,  13.,   3.,   9.,   6.,   8.,  11.,   3.,  25.,  66.]),\n",
       " array([  0. ,  25.5,  51. ,  76.5, 102. , 127.5, 153. , 178.5, 204. ,\n",
       "        229.5, 255. ]),\n",
       " <a list of 10 Patch objects>)"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAPtElEQVR4nO3dXYxdV3nG8f/TmISKL+djEkW2VYditXBDYo1SV6lQS1qamKpOJSKlqhorsuSbUIFo1ZpyUSr1IqlUUiKhSC5J6yAKRAEUC1JKZIJQLxKYQHASTGqTpvHUbjw0H0AjoIG3F2cZJvYZz/HMGZ/Myv8njfbe715nzrvYk8d71pxzSFUhSerLL0y6AUnS+BnuktQhw12SOmS4S1KHDHdJ6tCaSTcAcMEFF9TGjRsn3YYkrSoPPfTQd6tqati5l0W4b9y4kZmZmUm3IUmrSpL/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P6b5fhD4syFj39J+ps8BLmk/62dNeg6nMdeLgc1t/3XAv7c5dXl9TzHfiV3f1Xzn/rOPOaiqHwPHP+agd9uAPW1/D3DNBHtZlqr6CvDMCeWF5rcNuLMGHgDWJrn4zHQ6HgvMdyHbgE9W1Y+q6j+AQwx+5leFqjpaVV9v+98HDjB493qX1/cU813Iil/f1Rzuwz7m4FT/Y65GBXwxyUPt4xoALqqqozD4gQIunFh3K2Oh+fV8vd/dliLumLfM1s18k2wELgMe5BVwfU+YL0zo+q7mcB/pYw5WuSuqajNwNXBjkrdNuqEJ6vV63wb8MnApcBT4u1bvYr5JXgt8GnhvVX3vVEOH1HqY78Su72oO9+4/5qCqjrTtMeCzDH5te/r4r6tte2xyHa6IhebX5fWuqqer6idV9VPgH/j5r+arfr5JXsUg6D5eVZ9p5W6v77D5TvL6ruZw7/pjDpK8Jsnrju8D7wAeZTDH7W3YduCeyXS4Yhaa317g+vaqii3A88d/vV/NTlhX/gMG1xgG870uyTlJLgE2AV890/0tVZIAtwMHqupD8051eX0Xmu9Er++k/8q8zL9Qb2XwV+nvAB+YdD9jntsbGfw1/ZvAY8fnB5wP7AMOtu15k+51GXP8BINfVf+PwZ3MjoXmx+DX2I+0a/0IMD3p/sc034+1+exv/8FfPG/8B9p8HweunnT/pznX32CwzLAfeLh9be31+p5ivhO7vn78gCR1aDUvy0iSFmC4S1KHDHdJ6pDhLkkdMtwlqUOGuyR1yHCXpA79P/2Pnk0P2M9/AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#查看图片的像素值\n",
    "plt.hist([some_digit])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([676.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0., 108.]),\n",
       " array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. ]),\n",
       " <a list of 10 Patch objects>)"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD5CAYAAADcDXXiAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAREUlEQVR4nO3cf4xlZ13H8feHrgVRYEs7bZrdrQthQRoSoJm0a0j8wSqhi2H7ByVtxC7NxhWtRIOJrJr4+4/WRCuNpLqhyC5RaKliN1DR2h9BiVuY0lp+VOxSa3fc2h1su/5oUKtf/7jPynR3dufszNyZzrPvV3JzznnOc+/5PntnP3PmueeeVBWSpL68YKULkCQtPcNdkjpkuEtShwx3SeqQ4S5JHTLcJalDa+brkOQ1wM2zml4J/BKwt7VvBB4F3llVTyUJ8AFgK/AM8O6q+uLJjnHOOefUxo0bF1C+JJ2+7rvvvm9U1cRc+3Iq17knOQP4J+AS4Brgyaq6Nsku4Kyqen+SrcB7GYX7JcAHquqSk73u5ORkTU1NDa5DkgRJ7quqybn2neq0zBbg61X1j8A2YE9r3wNc1ta3AXtrZD+wNsn5C6hbkrRApxruVwAfa+vnVdXjAG15bmtfBxyc9Zzp1vYcSXYmmUoyNTMzc4plSJJOZnC4JzkTeDvwifm6ztF23NxPVe2uqsmqmpyYmHPKSJK0QKdy5n4p8MWqeqJtP3F0uqUtD7f2aWDDrOetBw4ttlBJ0nCnEu5X8q0pGYB9wPa2vh24bVb7VRnZDBw5On0jSVoe814KCZDkxcAPAT8+q/la4JYkO4DHgMtb++2MrpQ5wOhSyKuXrFpJ0iCDwr2qngHOPqbtXxhdPXNs32J0maQkaYX4DVVJ6pDhLkkdGjQt83y2cdenV+zYj177thU7tiSdjGfuktQhw12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M5ixuTIWP+MeCDVfUUQFUdXuYal9qQMRfw0rb+Mlb5d2Wq6rPAkyfpsg3YWyP7gbVJzl/MMVdLuM91S4N1J+pTVc8CR4Czl6W68Rgy5tl2MPrNv5rNO+YkbwQ2VNWnlrOwMRryPr8aeHWSzyXZn+Sty1bdeAwZ868A70oyDdwOvHd5Slsxp/r/fV7juP3AOAy5pcGg2x6sIoPHk+RdwCTwfWOtaPxOOuYkLwCuB969XAUtgyHv8xpGUzPfz+ivs79K8rqqenrMtY3LkDFfCXykqn4ryfcAH21j/t/xl7ciljy/VsuZ+5BbGvx/nyRrGP0pd7I/g57vBt3GIckPAr8IvL2q/nOZahuX+cb8EuB1wD1JHmU0N7lvlX+oOvRn+7aq+u+q+gfga4zCfrUaMuYdwC0AVfU3wIsY3VSsV0t+25bVEu5DbmmwD9je1t8B3FXtk4pVat4xtymK32cU7Kt9HhbmGXNVHamqc6pqY1VtZPQ5w9uramplyl0SQ362/5TRh+ckOYfRNM0jy1rl0hoy5seALQBJXsso3GeWtcrltQ+4ql01sxk4UlWPL+oVV/pT5FP4tHkr8PeMPmX/xdb2a4z+c8Pozf8EcAD4PPDKla55Gcb8l8ATwAPtsW+lax73mI/pew+r/GqZge9zgN8Gvgp8CbhipWtehjFfCHyO0ZU0DwBvWemaFznejwGPA//N6Cx9B/Ae4D2z3uMPtn+PLy3Fz7W3H5CkDq2WaRlJ0ikw3CWpQ4a7JHXIcJekDhnuktQhw12SOmS4S1KH/g8SN/qIGGUh8QAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#将非0的值转换为1\n",
    "x_train[x_train>0] = 1\n",
    "plt.hist(x_train[3600])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAY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2vkn4paXkNfQw8d98j6dwli5dLGs1uj2ryj6XvcnobCO4+5u7vZ7cnJH0+zXitr12ir76oI+y3STo55f4pDdZ87y7pN2b2npmN1N1MB7e6+5g0+ccj6Zaa+7lU4TTe/XTJNOMD89p1M/15WXWEvdNUUoM0/nePuy+R9ICkx7O3q5ieaU3j3S8dphkfCN1Of15WHWE/Jen2KffnS/qkhj46cvdPsutxSds1eFNRn/58Bt3serzmfv5hkKbx7jTNuAbgtatz+vM6wv6upIVm9iUzmyFphaSdNfRxGTO7KTtwIjO7SdI3NXhTUe+UtDq7vVrSjhp7ucigTOOdN824an7tap/+3N37fpH0oCaPyP9R0g/q6CGnrzsk7c8uH9bdm6RXNfm27v81+Y7oO5JulrRb0kfZ9ZwB6u2/JB2Q9IEmgzW3pt7+VZMfDT+QtC+7PFj3a5foqy+vG1+XBYLgG3RAEIQdCIKwA0EQdiAIwg4EQdiBIAg7EMTfAa5yOtysgto/AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "t_59999 = x_train.reshape(60000,28,-1)[59999]\n",
    "plt.imshow(t_59999)\n",
    "some_digit = x[36000]\n",
    "plt.imshow(some_digit.reshape(28,-1,),cmap='binary')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.88817237, 0.88969448, 0.88813322])"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cross_val_score(sgd_clf,x_train,y_train,cv = 3,scoring = 'accuracy')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [],
   "source": [
    "#绘图，\n",
    "def plot_digits(instances, images_per_row=10, **options):\n",
    "    size = 28\n",
    "    images_per_row = min(len(instances), images_per_row)\n",
    "    images = [instance.reshape(size,-1) for instance in instances]\n",
    "    n_rows = (len(instances) - 1) // images_per_row + 1\n",
    "    row_images = []\n",
    "    n_empty = n_rows * images_per_row - len(instances)\n",
    "    images.append(np.zeros((size, size * n_empty)))\n",
    "    for row in range(n_rows):\n",
    "        rimages = images[row * images_per_row : (row + 1) * images_per_row]\n",
    "        row_images.append(np.concatenate(rimages, axis=1))\n",
    "    image = np.concatenate(row_images, axis=0)\n",
    "    plt.imshow(image, cmap = 'binary', **options)\n",
    "    plt.axis(\"off\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(5245, 784)"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cl_3,cl_5 = 3,5\n",
    "image_33 = x_train[(y_train == 3)&(y_train_predict==3)]\n",
    "image_33.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(203, 784)"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "image_35 = x_train[(y_train == 3)&(y_train_predict==5)]\n",
    "image_35.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(155, 784)"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "image_53 = x_train[(y_train == 5)&(y_train_predict==3)]\n",
    "image_53.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(4498, 784)"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "image_55 = x_train[(y_train == 5)&(y_train_predict==5)]\n",
    "image_55.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAccAAAHBCAYAAAAcpXCvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3d3bajuo6GYdKj7/+W0ydNVZbKgG0k6xO8zxj7ZK+aiWJs5D/M5/v9bgAA4K//yQ4AAAA1JEcAAAySIwAABskRAACD5AgAgEFyBADA+N+L/85zHsC/PtkBTKI9A/9qtmdGjgAAGCRHAAAMkiMAAAbJEQAAg+QIAIBxtVsVi30+YxshVx8c/xvf9/vtijcqxv27fz9/pPw4dB9ZRtv57o119qisossiPDleVQLFi511MWZ8Pp9lcdly6W3gnjG2vnP2RoNjmZ2eXuodSRUVO4w9MUff+0KS48jFaPX+M/RejF8RMe+fOTNCw5iVHYsnyiw/2kMMe9/JjiETa44AABgya4704v/LlsXsupqnOyPY1de39V0qPdIKemcwVs/83LmGyvcYhfZtrS6vs9/dqo/RZJLjtuVOsWYU/iiF2I6uzarYZupGpTVkNa1OmkI9nKF0vVe2o7PEq349M+/LTKsCAGCEjBwrjMKOKE5vPMHbF/fho/K95cjKHf1Ko+czPffh0o9yjK77ZFy4Co1MNUbiep9qZauaDHrLMTL+atdyNaZVAQAwlm7IUeqpqJ9QoVRWO/Uy27a5Z2y3TXeEoaRVtpknNFUwE290maqW4ehMY/QGTpndqso3J9Wb+yoVkuJdytv8s1Xe7ZvZAap4Mo2V8QTB6P0mqtO2JDmqrTNijZU3JrVnpJ7iqudeqf0qx6tyUtiRFW3Zs316XGvWHAEAMD4X2dWli1Bt5KgwjXR2juvqtR+PHt3qkePZ9zlsna86BB2+CNWmBpXiVVxvtJSWTGbvu1HtOT05/vmioLc2PPFEFZKjjxvX+TXJsaVCZ1fhUYkjFcpv27TL8Mjkvb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TX4znN42ZUguxGpbC7o/Y5K1xZ5nn7t77RJ1Q5FS1SsTKsCAGCk71b9pXgmqOeO0jtxZPIageM9skdlKW9xGJjaV2k32ffFlpHDACLLcSg5Rt7gsxvTLjqOFbv6Zn/DyNFrK+JpfY7KTQU6pyD9UqkfiknnLoUD0lfGwLQqAACGzNmq3hTfR3dF8TxGxZh2ia/b0RiejDv8scrvEf311PqoHNu21Xs1mcfZqo9NjvC36F2JFTwuOW6b9s19Nxrj6vqovlNavfx2i5N588ukNuRA20sSH4rLrKfqbUQ9vt3M/hbv38aaIwAABiNHAEMYmWGVzOtNcgSwbRuJB/jFtCoAAAbJEQAA42pateqWdQD/oj0DnRg5AgBgkBwBADBIjgAAGCRHAAAMkiMAAAbJEQAA4/8AuRW04yCgoIoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 576x576 with 4 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(8,8))\n",
    "plt.subplot(221); \n",
    "plot_digits(image_33[:25], images_per_row=5)\n",
    "plt.subplot(222); \n",
    "plot_digits(image_35[:25], images_per_row=5)\n",
    "plt.subplot(223);\n",
    "plot_digits(image_53[:25], images_per_row=5)\n",
    "plt.subplot(224); \n",
    "plot_digits(image_55[:25], images_per_row=5)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [],
   "source": [
    "#00图：实际为3，预测为3的图\n",
    "#01图，实际为3，预测为5的图\n",
    "#10图，实际为5，预测为3的图\n",
    "#11图，实际为5，预测为5的图"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 作业3，将图片的像素上下左右各移动一个像素，然后作为训练集进行训练，查看预测分数及预测值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4C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3f2vkn4paXkNfQw8d98j6dwli5dLGs1uj2ryj6XvcnobCO4+5u7vZ7cnJH0+zXitr12ir76oI+y3STo55f4pDdZ87y7pN2b2npmN1N1MB7e6+5g0+ccj6Zaa+7lU4TTe/XTJNOMD89p1M/15WXWEvdNUUoM0/nePuy+R9ICkx7O3q5ieaU3j3S8dphkfCN1Of15WHWE/Jen2KffnS/qkhj46cvdPsutxSds1eFNRn/58Bt3serzmfv5hkKbx7jTNuAbgtatz+vM6wv6upIVm9iUzmyFphaSdNfRxGTO7KTtwIjO7SdI3NXhTUe+UtDq7vVrSjhp7ucigTOOdN824an7tap/+3N37fpH0oCaPyP9R0g/q6CGnrzsk7c8uH9bdm6RXNfm27v81+Y7oO5JulrRb0kfZ9ZwB6u2/JB2Q9IEmgzW3pt7+VZMfDT+QtC+7PFj3a5foqy+vG1+XBYLgG3RAEIQdCIKwA0EQdiAIwg4EQdiBIAg7EMTfAa5yOtysgto/AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#原图\n",
    "plt.imshow(some_digit.reshape(28,-1,),cmap='binary')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAANaklEQVR4nO3dX4hc9RnG8eepsV5UsbEZNVjp2iA1gaUxLFawiKW01RCIQkvqhc2FJQoGFNqLbXvRuWxLo1AIQsTQbbGWgoqC/Se7AVNobTcSY8Jio23ari7JilC9aqu+vZiz6XSc2ZmdOTOz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/l2v+rGpPB5yQdLx42zni57nVmgd2rnkpPQAktV6fQgEAtEHAASApAg4ASRFwAEiKgANAUgQcAJIi4ACQ1H8BsVmpNeyxKnoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#查看图片的像素分布\n",
    "plt.hist(some_digit.reshape(28,-1,))\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAANXUlEQVR4nO3df2zcdR3H8ddLqxIV53QHLohWlylbbBykQQwRMaiZhDhNUFgizmQ6p2Ig+k+jf3jRf4xxkJgs6pSFahTFnyyCP7CdYRpAO50wbBTEqdVlK0GRxPhj8PaP+26W0va+vft+7/pun4+k6d33vtd7f2h57va9+3aOCAEA8nlKvwcAAHSGgANAUgQcAJIi4ACQFAEHgKQGevlga9asicHBwV4+JACkd/DgwYciojF7e08DPjg4qImJiV4+JACkZ/uPc23nEAoAJEXAASApAg4ASRFwAEiKgANAUgQcAJIi4ACQFAEHgKQIOAAklSbggyO3Ss1VGhod0uQ5Gyr5mrt3jmvXFZdpauSAms1mJV8TAHolTcABAE9EwAEgKQIOAEkRcABIioADQFIEHACSIuAAkBQBB4CkCDgAJEXAASApAg4ASRFwAEiKgANAUgQcAJIi4ACQFAEHgKQIOAAkRcABIKm2Abd9tu39tidt32f7mmJ70/ZfbB8qPi6tf1wAwEkDJfY5IenDEfFL26dLOmj79uK26yPi0/WNBwCYT9uAR8RRSUeLy4/anpR0Vt2D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q2DbnPhFxQtIjkp7fk+nqU2bdM21X60/r7Nqu2/a5ks6OiO/1crCalfl+v0zSy2z/zPZdtjf3bLr6lFl3U9I7bE9Juk3SB3szWt8ttgFP0s2p9FUpc0p+qdP2kym9JtvvkDQs6bW1TtQbC67b9lMkXS/pXb0aqEfKfL8H1DqMcrFaf9s6YPsVEfH3mmerU5l1b5V0Y0Tssv1qSV8u1v14/eP1VdddWwrPwMuckn9qH9sDav01a6G/mmRQ6lcR2H69pI9KenNE/LtHs9Wp3bpPl/QKST+xfUStY4P7lsELmWV/zm+JiP9GxB/U+sVv63s0X13KrHu7pJslKSLulHSaWr/sabnr+teRLIWAlzklf5+kbcXlyyWNR/EqQGJt110cSvi8WvFeDsdDpTbrjohHImJNRAxGxKBax/7fHBET/Rm3MmV+zr+r1gvXsr1GrUMqD/Z0yuqVWfefJF0iSbY3qBXw6Z5O2R/7JL2zeDfKBZIeiYiji/oK/X6ldsarsb9T69XqjxbbPq7W/7hS6xv6DUkPSPq5pJf2e+YerfvHko5JOlR87Ov3zL1Y96x9f6Jl8C6Ukt9vS7pO0m8k3Svpyn7P3KN1b5T0M7XeoXJI0hv7PXNF675J0lFJ/1Xr2fZ2STsl7Zzx/d5d/He5t5Ofc06lB4CklsIhFABABwg4ACRFwAEgKQIOAEkRcABIioADQFIEHACS+h9vm17ERAyCHwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#将>0的值置为1\n",
    "x_36000 = some_digit.reshape(28,-1,)\n",
    "x_36000[x_36000>0] = 1\n",
    "plt.hist(x_36000)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAL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L0C0lzkj6UtCsi/jHRQQawPSupGxGNvwDD9h2SvpL0p4j4cbHtt5LORsSe4h/KNRHx65bM9oykr5pexrtYrWjD0mXGJd0r6Vdq8L5bYa5fagL3WxN79q2SPomITyPia0mvSdrZwBytFxHvSTp70eadkvYV5/dp8S/LxA2YrRUiYj4iPi7On5N0YZnxRu+7FeaaiCZi3yjp8yWX59Su9d5D0ju2P7I93fQwy1gfEfPS4l8eSTc2PM/Fhi7jPUkXLTPemvtunOXPy2oi9uWWkmrT8b9tEXG7pHskPVI8XMVoRlrGe1KWWWa8FcZd/rysJmKfk7RpyeWbJJ1qYI5lRcSp4nRB0ltq31LUpy+soFucLjQ8z/+1aRnv5ZYZVwvuuyaXP28i9g8lbbZ9s+1rJT0gaX8Dc1zC9nXFEyeyfZ2ku9W+paj3S9pdnN8t6e0GZ/mOtizjPWiZcTV83zW+/HlETPxL0g4tPiP/b0m/aWKGAXP9UNLfi6/jTc8m6VUtPqz7rxYfET0k6fuSDkk6WZyubdFsf5Z0VNIRLYa1oaHZfqbFXw2PSDpcfO1o+r5bYa6J3G+8XBZIglfQAUkQO5AEsQNJEDuQBLEDSRA7kASxA0n8D/XDuujBLPM4AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.imshow(x_36000,cmap='binary')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
      "[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
      "[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
      "[0 0 0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 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0]\n",
      "[0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0]\n",
      "[0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
      "[0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
      "[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
      "[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
      "[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
      "[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
      "[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n"
     ]
    }
   ],
   "source": [
    "for i in x_36000:\n",
    "    print(i)\n",
    "#     for k in i:\n",
    "#         print(k)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### [矩阵计算线性代数原理](https://zhuanlan.zhihu.com/p/86913029)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "#x = x0+dx\n",
    "#y = y0+dy\n",
    "# dx,dy = 1,0\n",
    "# tranlstion_matrix = np.array([[1,0,dx],[0,1,dy],[0,0,1]])\n",
    "# tranlstion_matrix"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [],
   "source": [
    "#将图片平移\n",
    "def move_metrix(digit_image,dx,dy):\n",
    "    tranlstion_matrix = np.array([[1,0,dx],[0,1,dy],[0,0,1]])\n",
    "    target_matrix = np.zeros(shape=digit_image.shape)\n",
    "    for x0 in range(digit_image.shape[0]):\n",
    "        for y0 in range(digit_image.shape[1]):\n",
    "            original_point = np.array([x0,y0,1])\n",
    "            target_point = np.dot(tranlstion_matrix,original_point)\n",
    "            x, y, _ = target_point\n",
    "            x, y = int(x), int(y)\n",
    "            if x>(digit_image.shape[0]-1) or y>(digit_image.shape[1]-1) or x<0 or y<0:\n",
    "                        pass\n",
    "            else:\n",
    "                target_matrix[x,y] = digit_image[x0,y0]\n",
    "    return target_matrix\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAALAElEQVR4nO3dT4ic9R3H8c+nai/qIWnGsMTQtRJKpdAoQyikiEWUmEv00GIOkoKwHhQUPFTsoR5DqUoPRVhrMC1WKaiYQ2gNQRChiKOk+dPQxsq2rlmyE3Iwnmz028M+KWvc2ZnM8zzzPNnv+wXDzDwzu88nT/LJM/P8npmfI0IA1r5vNB0AwGRQdiAJyg4kQdmBJCg7kMTVk1zZhg0bYnp6epKrBFKZm5vT2bNnvdJjpcpue4ek30i6StLvImLvas+fnp5Wr9crs0oAq+h2uwMfG/tlvO2rJP1W0j2SbpG02/Yt4/4+APUq8559m6QPI+KjiPhc0iuSdlUTC0DVypR9k6SPl92fL5Z9he0Z2z3bvX6/X2J1AMooU/aVDgJ87dzbiJiNiG5EdDudTonVASijTNnnJW1edv9GSafLxQFQlzJlf0/SFts32f6mpPslHagmFoCqjT30FhEXbD8i6S9aGnrbFxEnKksGoFKlxtkj4qCkgxVlAVAjTpcFkqDsQBKUHUiCsgNJUHYgCcoOJEHZgSQoO5AEZQeSoOxAEpQdS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": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "def show_matrix(matrix_target):\n",
    "    for x in range(matrix_target.shape[0]):\n",
    "        for y in range(matrix_target.shape[1]):\n",
    "            if(matrix_target[x,y]==1):\n",
    "                print('x = %s,y  = %s'%(x,y))\n",
    "                break\n",
    "                \n",
    "  \n",
    "#向左移动一个像素\n",
    "# show_matrix(move_metrix(x_36000,0,1))\n",
    "plt.imshow(move_metrix(x_36000,0,1),cmap='binary')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAALAElEQVR4nO3dT4ic9R3H8c+nai/qIWnGsMTQtRJKpdAoQyikiEWUmEv00GIOkoKwHhQUPFTsoR5DqUoPRVhrMC1WKaiYQ2gNQRChiKOk+dPQxsq2rlmyE3Iwnmz028M+KWvc2ZnM8zzzPNnv+wXDzDwzu88nT/LJM/P8npmfI0IA1r5vNB0AwGRQdiAJyg4kQdmBJCg7kMTVk1zZhg0bYnp6epKrBFKZm5vT2bNnvdJjpcpue4ek30i6StLvImLvas+fnp5Wr9crs0oAq+h2uwMfG/tlvO2rJP1W0j2SbpG02/Yt4/4+APUq8559m6QPI+KjiPhc0iuSdlUTC0DVypR9k6SPl92fL5Z9he0Z2z3bvX6/X2J1AMooU/aVDgJ87dzbiJiNiG5EdDudTonVASijTNnnJW1edv9GSafLxQFQlzJlf0/SFts32f6mpPslHagmFoCqjT30FhEXbD8i6S9aGnrbFxEnKksGoFKlxtkj4qCkgxVlAVAjTp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diAJyg4kQdmBJP4HvrW7IuKMhEcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.imshow(move_metrix(x_36000,0,1),cmap='binary')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAdsAAAHSCAYAAACkdWH8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAb80lEQVR4nO3dX6hld3k38O/z+udGvUiakzDEtGMlvLQUGushFFKKRZQ0N9GLFnMhKQjjhQEFLyr2orkMxT/04kUYm5C0WKWgYi5CawhCEF4kZ0KaP85bYyWtY4bMkVwYr2zi817MDh7H8y/77N9e65z5fGCx915n77Oe+c1+5jtr7fXbq7o7AMA4/2vqAgDgpBO2ADCYsAWAwYQtAAwmbAFgMGELAIO9+Sgvrqrbk/x9kjcl+Yfuvm+/51933XV9+vTpo2wSTpxz5879tLs3pq7jjfSzXobftF8vLx22VfWmJP8nyQeSXEjyRFU93N3f3+s1p0+fztbW1rKbhBOpqv5rBjW8oX7Wy/Cb9uvloxxGvjXJD7v7R939iyRfS3LnEX4fMB39DAMdJWxvTPLjHY8vLNb9mqo6U1VbVbW1vb19hM0BAx3Yz3oZlneUsK1d1v3Gdz9299nu3uzuzY2NyT+WAnZ3YD/rZVjeUcL2QpKbdjx+Z5IXj1YOMBH9DAMdJWyfSHJzVb2rqt6a5CNJHl5NWcCa6WcYaOmzkbv71aq6J8m/5fJUgQe6+7mVVQasjX6GsY40z7a7H0nyyIpqASakn2Ec3yAFAIMJWwAYTNgCwGDCFgAGE7YAMJiw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+IE9VvS3JB5M8u/+r1uLhJHcv7t+d5FtTFfJ6Iyx8OGsan6qqJPcnOd/dX9jxo7WPzV61TDU2MzKbXk5m28+z6eVEP+9Xy/Cx6e61L0nuyOWzGP8zyd9MUcOijt9N8u+L5bkpakny1Vw+ZPE/ubyn8LEkv5XksSTPL26vnbCWf0ryTJKnc7kxTq2plj/J5UOSTyd5arHcMcXY7FPLJGMzp2UuvbyoZdJ+nlMv71OPfp6on31dIwAM5hukAGAwYQsAgwlbABhM2ALAYMIWAAYTtgAwmLAFgMH+P9YhvKy1kS83AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 576x576 with 4 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#上下左右各移动5个像素的图片\n",
    "plt.figure(figsize=(8,8))\n",
    "plt.subplot(221); \n",
    "plt.imshow(move_metrix(x_36000,0,5),cmap='binary')\n",
    "plt.subplot(222); \n",
    "plt.imshow(move_metrix(x_36000,0,-5),cmap='binary')\n",
    "plt.subplot(223);\n",
    "plt.imshow(move_metrix(x_36000,5,0),cmap='binary')\n",
    "plt.subplot(224); \n",
    "plt.imshow(move_metrix(x_36000,-5,0),cmap='binary')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [],
   "source": [
    "# show_matrix(x_36000)\n",
    "#获取上下左右四个方向各移动一个方向的数据的副本\n",
    "def divider_move_metrix(dx,dy,metrix_m = x_train):\n",
    "    x_train_28_28 = metrix_m.reshape(60000,28,-1)\n",
    "#     x_train_alter = []\n",
    "    x_train_left = []\n",
    "    x_train_right = []\n",
    "    x_train_top = []\n",
    "    x_train_down = []\n",
    "    for x in range(x_train_28_28.shape[0]):\n",
    "#       x_train_alter.append(move_metrix(x_train_28_28[x],0,1))\n",
    "        x_train_left.append(move_metrix(x_train_28_28[x],0,1))\n",
    "        x_train_right.append(move_metrix(x_train_28_28[x],0,-1))\n",
    "        x_train_top.append(move_metrix(x_train_28_28[x],1,0))\n",
    "        x_train_down.append(move_metrix(x_train_28_28[x],1,0))\n",
    "    return x_train_left.reshape(),x_train_right,x_train_top,x_train_down\n",
    "# x_train_left = divider_move_metrix(0,1)\n",
    "# x_train_right = divider_move_metrix(0,-1)\n",
    "# x_train_top = divider_move_metrix(1,0)\n",
    "# x_train_down = divider_move_metrix(-1,0)\n",
    "# x_train_left,x_train_right,x_train_top,x_train_down = divider_move_metrix(0,0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [],
   "source": [
    "# np.array(x_train_left).reshape(60000,-1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [],
   "source": [
    "#查看偏移后的分数对比\n",
    "# print('x_train:',cross_val_score(sgd_clf,x_train,y_train,cv = 3,scoring = 'accuracy'))\n",
    "# print('x_train_left:',cross_val_score(sgd_clf,np.array(x_train_left).reshape(60000,-1),y_train,cv = 3,scoring = 'accuracy'))\n",
    "# print('x_train_right:',cross_val_score(sgd_clf,np.array(x_train_right).reshape(60000,-1),y_train,cv = 3,scoring = 'accuracy'))\n",
    "# print('x_train_top:',cross_val_score(sgd_clf,np.array(x_train_top).reshape(60000,-1),y_train,cv = 3,scoring = 'accuracy'))\n",
    "# print('x_train_down:',cross_val_score(sgd_clf,np.array(x_train_down).reshape(60000,-1),y_train,cv = 3,scoring = 'accuracy'))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 作业二：使用KNN"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### [KNeighborsClassifier参数说明](https://www.cnblogs.com/pinard/p/6065607.html)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "KNeighborsClassifier(algorithm='auto', leaf_size=30, metric='minkowski',\n",
       "                     metric_params=None, n_jobs=None, n_neighbors=5, p=2,\n",
       "                     weights='uniform')"
      ]
     },
     "execution_count": 86,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.neighbors import KNeighborsClassifier\n",
    "knn = KNeighborsClassifier(n_neighbors=5)\n",
    "knn.fit(x_train,y_train)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [],
   "source": [
    "#algorithm:KNN和限定半径最近邻法使用的算法(第一种brute是蛮力实现，第二种kd_tree是KD树实现，\n",
    "#第三种ball_tree是球树实现),auto自动权衡\n",
    "#leaf_size这个值控制了使用KD树或者球树时， 停止建子树的叶子节点数量的阈值。\n",
    "# 这个值越小，则生成的KD树或者球树就越大，层数越深，建树时间越长，\n",
    "# 反之，则生成的KD树或者球树会小，层数较浅，建树时间较短。\n",
    "#metric欧式距离 “euclidean”，曼哈顿距离 “manhattan”， 切比雪夫距离“chebyshev”，\n",
    "# 闵可夫斯基距离 “minkowski”(默认参数)p=1为曼哈顿距离， p=2为欧式距离....\n",
    "# P:p是使用距离度量参数 metric 附属参数，只用于闵可夫斯基距离和带权重闵可夫斯基距离中p值的选择，\n",
    "# p=1为曼哈顿距离， p=2为欧式距离。默认为2\n",
    "# 近邻权weights :uniform,distance\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [],
   "source": [
    "# cross_val_score(knn,x_train,y_train,cv =3,scoring = 'accuracy')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 使用网格搜索来调超参数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import GridSearchCV\n",
    "param_grid = [\n",
    "    {'algorithm': ['brute', 'kd_tree', 'ball_tree'], 'p': [1, 2]},\n",
    "    {'weights': ['uniform','distance'], 'leaf_size': [40,50,70]},\n",
    "  ]\n",
    "gridCv = GridSearchCV(knn, param_grid, cv=3,\n",
    "                           scoring='neg_mean_squared_error', return_train_score=True)\n",
    "gridCv.fit(x_train,y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
